From 589684ffa9eb41f7bd6a46b88414474d9f972294 Mon Sep 17 00:00:00 2001 From: robertl Date: Sun, 7 Mar 2010 03:49:57 +0000 Subject: [PATCH] From Martin: * Initialize all gps_*_type and gps_*_transfer variables to -1 exactly once in GPS_A000() instead of some in GPS_A000(), some in GPS_A001(), some in both and some not at all * Bug fix (?): If device reports device command protocol A011, set gps_device_command to 1 (=A011) instead of 0 (=A010). Changes behaviour for aviation devices that report capabilities via A001 (if there are any). If this bugfix is wrong, there should be at least a comment stating that/why using the "wrong" command protocol is intentional * Minor indentation/comment fixes * Converted mixed hex/decimal constants for COMMAND_ID and LINK_ID to all-decimal. The rest of jeeps and the Garmin docs all use decimal, so it's easier to read/compare this way * Bug fix: Set course limits transfer protocol Cmnd_Transfer_Course_Limits to 565 (course limits transfer) instead of 564 (course tracks transfer) for devices using device command protocol 1 (A010). Shouldn't make a difference for gpsbabel, since this value isn't used (yet) * Bug fix: Set proximity transfer protocol Cmnd_Transfer_Prx to 17 instead of 0 (unsupported) for devices using device command protocol 2 (A011). Shouldn't make a difference for gpsbabel, since the functions using this value are never called --- jeeps/gpsapp.c | 103 ++++++++++++++++++++++++++---------------------- jeeps/gpsprot.c | 25 +++++++----- 2 files changed, 71 insertions(+), 57 deletions(-) diff --git a/jeeps/gpsapp.c b/jeeps/gpsapp.c index 9bcb95a6e..0aff1580f 100644 --- a/jeeps/gpsapp.c +++ b/jeeps/gpsapp.c @@ -220,29 +220,54 @@ static int32 GPS_A000(const char *port) gps_save_string, gps_save_id, gps_save_version); #if 0 - gps_date_time_transfer = pA600; - gps_date_time_type = pD600; /* All models so far */ - gps_position_transfer = pA700; - gps_position_type = pD700; /* All models so far */ + gps_date_time_transfer = pA600; + gps_date_time_type = pD600; /* All models so far */ + gps_position_transfer = pA700; + gps_position_type = pD700; /* All models so far */ #else - gps_date_time_transfer = -1; - gps_date_time_type = -1; - gps_position_transfer = -1; - gps_position_type = -1; + gps_date_time_transfer = -1; + gps_date_time_type = -1; + gps_position_transfer = -1; + gps_position_type = -1; #endif - gps_pvt_transfer = -1; - gps_pvt_type = -1; - gps_trk_transfer = -1; - gps_trk_type = -1; - gps_trk_hdr_type = -1; - gps_rte_link_type = -1; - - gps_prx_waypt_transfer = -1; - gps_prx_waypt_type = -1; - gps_almanac_transfer = -1; - gps_almanac_type = -1; - gps_lap_transfer = -1; - gps_lap_type = -1; + gps_pvt_transfer = -1; + gps_pvt_type = -1; + gps_trk_transfer = -1; + gps_trk_type = -1; + gps_trk_hdr_type = -1; + gps_rte_link_type = -1; + + gps_waypt_transfer = -1; + gps_waypt_type = -1; + gps_route_transfer = -1; + gps_rte_hdr_type = -1; + gps_rte_type = -1; + + gps_prx_waypt_transfer = -1; + gps_prx_waypt_type = -1; + gps_almanac_transfer = -1; + gps_almanac_type = -1; + + gps_lap_transfer = -1; + gps_lap_type = -1; + gps_run_transfer = -1; + gps_run_type = -1; + gps_workout_transfer = -1; + gps_workout_type = -1; + gps_workout_occurrence_type = -1; + gps_user_profile_transfer = -1; + gps_user_profile_type = -1; + gps_workout_limits_transfer = -1; + gps_workout_limits_type = -1; + gps_course_transfer = -1; + gps_course_type = -1; + gps_course_lap_type = -1; + gps_course_point_type = -1; + gps_course_limits_transfer = -1; + gps_course_limits_type = -1; + + gps_device_command = -1; + gps_link_type = -1; if(!GPS_Device_Wait(fd)) { @@ -342,22 +367,6 @@ static void GPS_A001(GPS_PPacket packet) US data; US lasta=0; - gps_link_type = -1; - gps_device_command = -1; - gps_waypt_transfer = -1; - gps_waypt_type = -1; - gps_route_transfer = -1; - gps_rte_hdr_type = -1; - gps_rte_type = -1; - gps_trk_transfer = -1; - gps_trk_type = -1; - gps_prx_waypt_transfer = -1; - gps_prx_waypt_type = -1; - gps_almanac_transfer = -1; - gps_almanac_type = -1; - gps_lap_transfer = -1; - gps_lap_type = -1; - entries = packet->n / 3; p = packet->data; @@ -383,7 +392,7 @@ static void GPS_A001(GPS_PPacket packet) gps_device_command = pA010-10; break; case 11: - gps_device_command = pA010-10; + gps_device_command = pA011-10; break; case 100: gps_waypt_transfer = pA100; @@ -633,13 +642,13 @@ static void GPS_A001(GPS_PPacket packet) { if (data == 906) gps_lap_type = pD906; - else if (data == 1001) - gps_lap_type = pD1001; - else if (data == 1011) - gps_lap_type = pD1011; - else if (data == 1015) - gps_lap_type = pD1015; - continue; + else if (data == 1001) + gps_lap_type = pD1001; + else if (data == 1011) + gps_lap_type = pD1011; + else if (data == 1015) + gps_lap_type = pD1015; + continue; } else if (lasta < 1002) @@ -3598,7 +3607,7 @@ int32 GPS_A301_Get(const char *port, GPS_PTrack **trk, pcb_fn cb) if(!GPS_Device_On(port, &fd)) return gps_errno; - if ((gps_trk_type == pD304) && gps_run_transfer) { + if ((gps_trk_type == pD304) && gps_run_transfer != -1) { drain_run_cmd(fd); } @@ -4149,7 +4158,7 @@ void GPS_D303b_Get(GPS_PTrack *trk, UC *data) /* * Let the caller decide if it wants to toss trackpionts with only - * hear and/or time data. + * heart rate and/or time data. */ if (lat_undefined || lon_undefined) { (*trk)->no_latlon = 1; diff --git a/jeeps/gpsprot.c b/jeeps/gpsprot.c index 58e8a1182..93bf9c971 100644 --- a/jeeps/gpsprot.c +++ b/jeeps/gpsprot.c @@ -36,35 +36,40 @@ static int32 gps_n_tag_unknown = 0; struct COMMANDDATA COMMAND_ID[2]= { + /* Device Command Protocol 1 (A010) */ { - 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x31,0x32,92,117,121,450,451,452,453,454,561,562,563,564,564 + 0,1,2,3,4,5,6,7,8,49,50,92,117,121,450,451,452,453,454,561,562,563,564,565 } , + /* Device Command Protocol 2 (A011) */ { - 0x00,0x04,0x00,0x00,0x08,0x14,0x00,0x15,0x1a,0x00,0x00 + 0,4,0,17,8,20,0,21,26,0,0 } }; struct LINKDATA LINK_ID[3]= { + /* Basic Link Protocol (L000) */ { - 0xfd,0xfe,0xff,248, - 0x06,0,0,0,0,0,0x15,0,0,0,0, + 253,254,255,248, + 6,0,0,0,0,0,21,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } , + /* Link Protocol 1 (L001) */ { - 0xfd,0xfe,0xff,248, - 0x06,0x0a,0x0c,0x0e,0x11,0x13,0x15,0x1b,0x1d,0x1e,0x1f, - 0x22,0x23,0x33,0x62,0x63, + 253,254,255,248, + 6,10,12,14,17,19,21,27,29,30,31, + 34,35,51,98,99, 134,149,152,990,991,992,993,994,1061,1062,1063,1064,1065,1066,222 } , + /* Link Protocol 2 (L002) */ { - 0xfd,0xfe,0xff,248, - 0x06,0x0b,0x0c,0x14,0x18,0,0x15,0x23,0x25,0x27,0x04, - 0,0x2b,0,0,0, + 253,254,255,248, + 6,11,12,20,24,0,21,35,37,39,4, + 0,43,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } }; -- 2.30.2